<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
  <div id="work"> This is my work!</div>
  <p id="job">This is my job</p>
  <script>
    window.onload = function () {
        // 获取文本节点
        const startNode = document.getElementById('work').childNodes[0]
        const endNode = document.getElementById('job').childNodes[0]
        // 两种创建rang的方式
        // const range = document.createRange()
        const range = new Range()
        range.setStart(startNode,1)
        range.setEnd(endNode,10)
        console.log('range:',range);
    }
  </script>
</body>
</html>
